package com.summer.content.feignClient;

import com.summer.pojo.CoursePublish;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@Component
public class EsClientFallbackFactory implements FallbackFactory<EsClient> {

    @Override
    public EsClient create(Throwable throwable) {
        return new EsClient() {
            @Override
            public boolean insert2es(CoursePublish coursePublish) {
                log.info("es服务不可用，走降级逻辑....");
                log.info("coursePublish = {}", coursePublish);
                return false;
            }
        };
    }
}
